import Vue from 'vue'
export default{
	namespaced: true,
	state: {
		hasLogin: 0,
		userInfo:null,
		openId:null,
		unionId:null,
		addressList:null,
		orderAccepter:null
	},
	mutations: {
		login(state, userInfo) {
			state.hasLogin = 1;
			state.userInfo = userInfo;
			if(userInfo.wechat_xcx_openid){
				Vue.prototype.setStore('openId',userInfo.wechat_xcx_openid);
			}
			if(userInfo.wechat_unionid){
				Vue.prototype.setStore('unionId',userInfo.wechat_unionid);
			}
		},
		logout(state) {
			state.hasLogin = 0;
			state.userInfo = null;
		},
		update(state, userInfo) {
			state.userInfo = userInfo;
		},
		setAddressList(state,addressList){
			state.addressList = addressList;
		},
		setOrderAccepter(state,orderAccepter){
			state.orderAccepter = orderAccepter;
		},
		setOpenId(state,openId){
			state.openId = openId;
		},
		setUnionId(state,unionId){
			state.unionId = unionId;
		}
	},
	actions: {
		
	}
}